<?php
/**
get current system date
    smarty input 'format' the format string of date
return date string
*/
function smarty_function_check_image_directory_path($params, &$smarty) 
{
    $id = $params['id'];

    if($id){
      $virtualID = $id-45100;
      if($id < 55100){
        //resource/innoforum_upload/$medium_directory_path/$item_id/topics/
        $largeDirectoryPath = "resource/innoforum_upload/large/".$id."/topics/";
        $mediumDirectoryPath = "resource/innoforum_upload/medium/".$id."/topics/";
      }else if($virtualID % 10000 == 0){
        $newDirectoryNumber = ($virtualID/10000);
        $largeDirectoryPath = "large".$newDirectoryNumber;
        $mediumDirectoryPath = "medium".$newDirectoryNumber;
        $largeDirectoryPath = "resource/innoforum_upload/".$largeDirectoryPath."/".$id."/topics/";
        $mediumDirectoryPath = "resource/innoforum_upload/".$mediumDirectoryPath."/".$id."/topics/";
      }else{
        $newDirectoryNumber = floor($virtualID/10000);
        $largeDirectoryPath = "large".$newDirectoryNumber;
        $mediumDirectoryPath = "medium".$newDirectoryNumber;
        $largeDirectoryPath = "resource/innoforum_upload/".$largeDirectoryPath."/".$id."/topics/";
        $mediumDirectoryPath = "resource/innoforum_upload/".$mediumDirectoryPath."/".$id."/topics/";
      }

      $smarty->assign("large_directory_path", $largeDirectoryPath);
      $smarty->assign("medium_directory_path", $mediumDirectoryPath);
    }
}
?>